#include <bits/stdc++.h>
using namespace std;

int n, m, dfn[100001], low[100001], flag[100001], idx, ans;
vector<int> edge[100001];

void tarjan(int u, int fa)
{
    dfn[u] = low[u] = ++idx;
    int child = 0;
    for (int x : edge[u]) {
        if (!dfn[x]) {
            child++;
            tarjan(x, u);
            low[u] = min(low[u], low[x]);
            if (fa != u && low[x] >= dfn[u] && !flag[u])
                flag[u] = true, ans++;
        } else if (x != fa)
            low[u] = min(low[u], dfn[x]);
    }
    if (fa == u && child >= 2 && !flag[u])
        flag[u] = true, ans++;
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    for (int i = 1; i <= n; i++)
        if (!dfn[i])
            idx = 0, tarjan(i, i);
    cout << ans << endl;
    for (int i = 1; i <= n; i++)
        if (flag[i])
            cout << i << " ";
    return 0;
}
